import models.*;

import org.junit.Test;
import play.test.*;

public class Maryam extends UnitTest {

	@Test
	public void testChangePassword() {
		IdeaDeveloper ideaDeveloper = new IdeaDeveloper("maryam", "maryam",
				"maryam", "maryam.assaedi@gmail.com", "1/7/1991", "nasr city");

		ideaDeveloper.changePassword("assaedi");

		assertEquals("assaedi", ideaDeveloper.password);
	}

	public void testBlockFromEntity() {

		IdeaDeveloper ideaDeveloper = new IdeaDeveloper("maryam", "maryam",
				"maryam", "maryam.assaedi@gmail.com", "1/7/1991", "nasr city");
		IdeaDeveloper ideaDeveloper2 = new IdeaDeveloper("maryam2", "maryam2",
				"maryam2", "maryam@gmail.com", "1/7/1991", "nasr city");
		Organizer organizer = new Organizer();
		organizer.ideaDeveloper = ideaDeveloper;
		Entities entity = new Entities();
		organizer.manages.add(entity);
		entity.managers.add(organizer);

		organizer.blockIdeaDeveloper(ideaDeveloper2, entity);

		assertTrue(entity.blocked.contains(ideaDeveloper2));
		assertTrue(ideaDeveloper2.blockedEnt.contains(entity));

	}

	public void testUnblockFromEntity() {
		IdeaDeveloper ideaDeveloper = new IdeaDeveloper("maryam", "maryam",
				"maryam", "maryam.assaedi@gmail.com", "1/7/1991", "nasr city");
		IdeaDeveloper ideaDeveloper2 = new IdeaDeveloper("maryam2", "maryam2",
				"maryam2", "maryam@gmail.com", "1/7/1991", "nasr city");
		Organizer organizer = new Organizer();
		organizer.ideaDeveloper = ideaDeveloper;
		Entities entity = new Entities();
		organizer.manages.add(entity);
		entity.managers.add(organizer);

		organizer.blockIdeaDeveloper(ideaDeveloper2, entity);
		organizer.unblockIdeaDeveloper(ideaDeveloper2, entity);
		
		assertFalse(entity.blocked.contains(ideaDeveloper2));
		assertFalse(ideaDeveloper2.blockedEnt.contains(entity));

	}

}
